package com.example.springboot.controller;

import com.example.springboot.entity.Reader;
import com.example.springboot.service.ReaderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@CrossOrigin    //解决跨域问题
@RestController
@RequestMapping("/reader")
public class ReaderController {

    @Autowired
    ReaderService readerService;

    @GetMapping("/list")
    public List<Reader> listReaders(){
        return readerService.listReaders();
    }
}
